feat(flags): support mixed targeting in local evaluation#138
Open
patricio-posthog wants to merge 1 commit intomainfrom
Open
feat(flags): support mixed targeting in local evaluation#138patricio-posthog wants to merge 1 commit intomainfrom
patricio-posthog wants to merge 1 commit intomainfrom
Conversation
turnipdabeets
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Feature flags with "mixed targeting" (the
feature-flag-mixed-targetingbeta) allow different condition sets within a single flag to target different aggregation levels — some targeting users/persons, others targeting groups.The SDK only reads
aggregation_group_type_indexat the flag level. For mixed flags this isnull, so the SDK treats all conditions as person-targeted. Group conditions fail property matching and the SDK falls back to a server-side HTTP call. This breaks customers using flags in environments that cannot make HTTP calls (e.g., background workers).Ports posthog-python#523 to posthog-ruby.
💚 How did you test it?
Updated
match_feature_flag_propertiesto resolve aggregation per condition when a condition sets its ownaggregation_group_type_indexthat differs from the flag level. Each condition uses the correct properties and bucketing value for its aggregation type. Backwards compatible with existing pure person and pure group flags.Added 5 new RSpec examples covering: person condition match, group condition match, no match, only-group-condition-no-groups-passed, and rollout bucketing. All 359 existing specs continue to pass; rubocop clean.
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset filereleaselabel to the PR